<%= render :partial => "/tr8n/admin/common/header" %>
<%= render :partial => "tabs", :locals => {:current_tab => tra("{comp} [span: is being translated by {translator_count||translator} into {language_count||language}]", nil, :comp => "#{image_tag("tr8n/icons/brick.png")} #{@comp.name}".html_safe, :translator_count => @translators.count, :language_count => @languages.count, :span => lambda{|t| "<span style='font-size:12px; color:#888'>#{t}</span>"})} %>

<table class="admin_table">
    <tr>
        <th width="160">
            Component Id
        </th>
        <td>
            <%=@comp.id %>
        </td>
    </tr>

    <tr>
        <th width="160">
            Application
        </th>
        <td>
            <%= @comp.application ? link_to(@comp.application.name, :action => :application, :app_id => @comp.application_id) : "unassigned" %>
        </td>
    </tr>

    <tr>
        <th>
            Key
        </th>
        <td>
            <%=@comp.key %>
        </td>
    </tr>
    <tr>
        <th>
            Name
        </th>
        <td>
            <%=@comp.name %>
        </td>
    </tr>
    <tr>
        <th>
            Description
        </th>
        <td>
            <%=@comp.description %>
        </td>
    </tr>
    <tr>
        <th>
            State
        </th>
        <td>
            <%=@comp.state %>
        </td>
    </tr>
    <tr>
        <th>
            Created At
        </th>
        <td>
            <%=@comp.created_at %>
        </td>
    </tr>
    <tr>
        <th>
            
        </th>
        <td>
            <%= tr8n_actions_tag([
                link_to_function("Update", "Tr8n.UI.Lightbox.show('/tr8n/admin/components/lb_update?comp_id=#{@comp.id}')"),
              ])
            %>
        </td>
    </tr>    
</table>

<%=  tr8n_sections_tag(:modes => [
          ["Component Metrics", {:mode => :metrics}],
          ["Sources", {:mode => :sources}],
          ["Languages", {:mode => :languages}],
          ["Translators", {:mode => :translators}],
          ["Translation Keys", {:mode => :translation_keys}],
          ["Translations", {:mode => :translations}],
        ],
        :params => {
          :id => @comp.id
        }, 
        :title => lambda{ |mode|
          html = []
          html << "#{mode.first} "
          if mode.last[:mode] == :metrics
            if params[:charts] == "true"
              html << "<span style='font-size:12px;'>"
              html << link_to("view as table", params.merge(:charts => false)) 
              html << "</span>"
            else
              html << "<span style='font-size:12px;'>"
              html << link_to("view as charts", params.merge(:charts => true)) 
              html << "</span>"
            end
          end
          html.join("").html_safe
        }
) %>

<%= render :partial => "/tr8n/admin/common/footer" %>
